home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / AElatticeRelated.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.9 KB  |  105 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. // FILE: AElatticeRelated.mel
  18. // INPUT: string (node name)
  19. // RETURN:    string[] (list of related nodes, with the node whose
  20. //            tab you want to be opened duplicated at the
  21. //            end of the array)
  22. //
  23.  
  24. global proc string[] AElatticeRelated (string $node)
  25. {
  26.     string $preferredNode = "";
  27.     string $retval[];
  28.  
  29.     int $ii, $jj;
  30.  
  31.     string $siblings[] = `listRelatives $node`;
  32.     
  33.     string $origNode = "";
  34.     string $flexorNode = "";
  35.     
  36.     // get the siblings which will include a flexor shape if
  37.     // it is a flexor and a non history lattice if it has history
  38.     //
  39.     
  40.     int $len = size($siblings);
  41.     for ($ii = 0; $ii < $len; $ii++) {
  42.  
  43.         string $currSib = $siblings[$ii];
  44.  
  45.         if ("flexorShape" == nodeType($currSib)) {
  46.             $flexorNode = $currSib;
  47.         }
  48.         if ("lattice" == nodeType($currSib)) {
  49.             string $hist[] = `listHistory $currSib`;
  50.             if (size($hist) == 0) {
  51.                 $origNode = $currSib;
  52.             }
  53.         }
  54.     }        
  55.  
  56.     if ($origNode != "") {
  57.         $retval[size($retval)] = $origNode;
  58.     }
  59.     if ($flexorNode != "") {
  60.         $retval[size($retval)] = $flexorNode;
  61.     }
  62.     
  63.     // look for a connected ffd node
  64.     //
  65.     string $conns[2] = `listConnections -s false ($node+".latticeOutput")`;    
  66.     $len = size($conns);
  67.     for ($ii = 0; $ii < $len; $ii++) {
  68.         if ("ffd" == nodeType($conns[$ii])
  69.         ||  "jointFfd" == nodeType($conns[$ii])) {
  70.             $retval[size($retval)] = $conns[$ii];
  71.  
  72.             // see if there is a locator on the sculpt
  73.             //
  74.             $conns = `listHistory ($conns[$ii]+".baseLatticeMatrix")`;
  75.             int $len = size($conns);
  76.             for ($ii = 0; $ii < $len; $ii++) {
  77.                 if ("baseLattice" == nodeType($conns[$ii])) {
  78.                     string $parents[] = `listRelatives -p ($conns[$ii])`;
  79.                     if (size($parents)) {
  80.                         $retval[size($retval)] = $parents[0];
  81.                     }
  82.                     break;
  83.                 }
  84.             }
  85.             break;
  86.         }
  87.     }
  88.  
  89.     // we duplicate this node in the list so that it will be selected
  90.     //
  91.     if ($flexorNode != "") {
  92.         $retval[size($retval)] = $flexorNode;
  93.     }
  94.     else if ($origNode != "") {
  95.         $retval[size($retval)] = $origNode;
  96.     }
  97.     
  98.     if (0 == size($retval)) {
  99.         $retval[0] = $node;
  100.     }
  101.  
  102.     return $retval;
  103. }
  104.  
  105.